import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Demo7 {
    public static void main(String[] args) {
        LocalDateTime dateTime = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy hh:mm:ss");

        System.out.println(dateTime.format(formatter)); //指定格式输出
        System.out.println(dateTime);                   //默认格式输出
    }
}
